﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="AnyOffice.general.notify.manage.index1" %>

<%@ Register TagPrefix="Webdiver" Namespace="Webdiver" Assembly="AspnetPager" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>文件通知管理</title>
		
		<script type="text/javascript" language="JavaScript"> 
 function open_notify(notify_id)
{
 URL="read_notify.aspx?notify_id="+notify_id;
 myleft=(screen.availWidth-500)/2;
 window.open(URL,"read_notify","height=400,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}

 function delete_notify(notify_id,page)
{
	msg='确认要删除该项文件通知么？';
	if(window.confirm(msg))
	{
		URL="delete.aspx?notify_id="+notify_id+"&type_id=<%=ViewState["TypeId"]%>&page="+page;
		window.location=URL;
	}
}

 function no_important(notify_id,page)
{
	msg='确认要取消置顶么？';
	if(window.confirm(msg))
	{
		URL="no_important.aspx?notify_id="+notify_id+"&type_id=<%=ViewState["TypeId"]%>&page="+page;
		window.location=URL;	}
}

function change_type(type_id)
{
 window.location="index.aspx?type_id="+type_id;
}

function show_reader(notify_id)
{
  URL="show_reader.aspx?notify_id="+notify_id;
  myleft=(screen.availWidth-500)/2;
  window.open(URL,"show_reader","height=500,width=700,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}                                              
		</script>
	</HEAD>
	<body class="bodycolor" topMargin="5">
		<form id="Form1" method="post" runat="server">
			<table class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
				<tr>
					<td class="Big" width="40%"><IMG src="/images/notify_open.gif" align="absMiddle"><span class="big3">
							文件管理</span>
					<SELECT id="ddlTypeId" name="ddlTypeId" runat="server" DataTextField="TypeName" DataValueField="TypeId" class="BigSelect">
					</SELECT>
					</td>
					<td vAlign="bottom" width="20%"><asp:literal id="litNavCount" runat="server"></asp:literal></td>
					<td vAlign="bottom" width="40%"><asp:literal id="litNavPager" runat="server"></asp:literal></td>
				</tr>
			</table>			
			<asp:panel id="pnlMain" runat="server">
					<br>		
					<asp:Repeater id="rptNotify" runat="server">
						<HeaderTemplate>
							<TABLE class="small" cellSpacing="1" cellPadding="3" width="100%" bgColor="#000000" border="0">
							<TR class="TableHeader">
								<TD noWrap align="center">标题</TD>
								<TD noWrap align="center">类型</TD>
								<TD noWrap align="center">发送范围</TD>											
								<TD noWrap align="center">发布人</TD>
								<TD noWrap align="center">创建时间</TD>
								<TD noWrap align="center">生效日期</TD>
								<TD noWrap align="center">终止日期</TD>
								<TD noWrap align="center">状态</TD>
								<TD noWrap align="center">操作</TD>
							</TR>
						</HeaderTemplate>
						<ItemTemplate>
							<tr class="TableLine1">
								<td>
									<a href="javascript:open_notify('<%#Eval("NotifyId")%>');"><span style="<%# (Convert.ToBoolean(Eval("Important").ToString()) == true) ? "font-weight: bold;color: #FF0000;" : ""%>"><%#Eval("Subject")%></span></a>
								</td>
								<td align="center" nowrap><%#Eval("TypeName")%></td>
								<td>
									<%#Eval("ToDeptNames").ToString() != string.Empty ? "<font color=#0000FF><b>部门：</b></font>" + Eval("ToDeptNames").ToString()  + "<br>": ""%>
									<%#Eval("ToPrivNames").ToString() != string.Empty ? "<font color=#0000FF><b>角色：</b></font>" + Eval("ToPrivNames").ToString() + "<br>" : ""%>
									<%#Eval( "ToUser").ToString() != string.Empty ? "<font color=#0000FF><b>人员：</b></font>" + GetUserNames(Eval( "ToUser").ToString()) : ""%>
								</td>
								<td align="center" nowrap>
								<u title="部门：<%#Eval("DeptName")%>" style="CURSOR:hand"><%#Eval("UserName")%></u>
								</td>
								<td align="center"><%#Eval("SendTime")%></td>					
								<td nowrap align="center"><%# Eval("BeginDate") != DBNull.Value ? Convert.ToDateTime(Eval("BeginDate")).ToString("d"):""%></td>
								<td nowrap align="center"><%# Eval("EndDate") != DBNull.Value ? Convert.ToDateTime(Eval("EndDate")).ToString("d"):""%></td>
								<td nowrap align="center"><%#GetStatusDesc(Convert.ToInt32(Eval("Status")))%></td>
								<td nowrap>
									<a href="edit.aspx?notify_id=<%#Eval("NotifyId")%>&type_id=<%=ViewState["TypeId"]%>&page=<%=ViewState["CurrentPage"]%>">修改</a>
									<a href="javascript:show_reader('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">查阅情况</a>
									<a href="javascript:delete_notify('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">删除</a>
									<%#Convert.ToInt32(Eval("Status")) == 0 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=0&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">立即生效</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 1 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=1&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">终止</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 2 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=2&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">生效</a>" : ""%>
									<%#Convert.ToBoolean(Eval("Important")) == true ? "<a href=\"javascript:no_important('" + Eval("NotifyId") + "','" + ViewState["CurrentPage"].ToString() + "')\">取消置顶</a>" : ""%>
								</td>
							</tr>
						</ItemTemplate>
						<AlternatingItemTemplate>
							<tr class="TableLine2">
								<td>
									<a href="javascript:open_notify('<%#Eval("NotifyId")%>');"><span style="<%# (Convert.ToBoolean(Eval("Important").ToString()) == true) ? "font-weight: bold;color: #FF0000;" : ""%>"><%#Eval("Subject")%></span></a>
								</td>
								<td align="center" nowrap><%#Eval("TypeName")%></td>
								<td>
									<%#Eval("ToDeptNames").ToString() != string.Empty ? "<font color=#0000FF><b>部门：</b></font>" + Eval("ToDeptNames").ToString()  + "<br>": ""%>
									<%#Eval("ToPrivNames").ToString() != string.Empty ? "<font color=#0000FF><b>角色：</b></font>" + Eval("ToPrivNames").ToString() + "<br>" : ""%>
									<%#Eval( "ToUser").ToString() != string.Empty ? "<font color=#0000FF><b>人员：</b></font>" + GetUserNames(Eval( "ToUser").ToString()) : ""%>
								</td>
								<td align="center" nowrap>
								<u title="部门：<%#Eval("DeptName")%>" style="CURSOR:hand"><%#Eval("UserName")%></u>
								</td>
								<td align="center"><%#Eval("SendTime")%></td>								
								<td nowrap align="center"><%# Eval("BeginDate") != DBNull.Value ? Convert.ToDateTime(Eval("BeginDate")).ToString("d"):""%></td>
								<td nowrap align="center"><%# Eval("EndDate") != DBNull.Value ? Convert.ToDateTime(Eval("EndDate")).ToString("d"):""%></td>
								<td nowrap align="center"><%#GetStatusDesc(Convert.ToInt32(Eval("Status")))%></td>
								<td nowrap>
									<a href="edit.aspx?notify_id=<%#Eval("NotifyId")%>&type_id=<%=ViewState["TypeId"]%>&page=<%=ViewState["CurrentPage"]%>">修改</a>
									<a href="javascript:show_reader('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">查阅情况</a>
									<a href="javascript:delete_notify('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">删除</a>
									<%#Convert.ToInt32(Eval("Status")) == 0 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=0&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">立即生效</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 1 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=1&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">终止</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 2 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=2&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">生效</a>" : ""%>
									<%#Convert.ToBoolean(Eval("Important")) == true ? "<a href=\"javascript:no_important('" + Eval("NotifyId") + "','" + ViewState["CurrentPage"].ToString() + "')\">取消置顶</a>" : ""%>
								</td>
							</tr>
							</AlternatingItemTemplate>
							<FooterTemplate>
							</TABLE>
							</FooterTemplate>
					</asp:Repeater>
					<TABLE width="100%" border="0">
					<TR>
						<TD>
							<Webdiver:AspNetPager id="AspNetPager1" runat="server" CssClass="small1" InputBoxClass="SmallInput" SubmitButtonClass="SmallButton"
								Font-Size="10pt" OnPageChanged="ChangePage" HorizontalAlign="Right" ShowCustomInfoSection="left" ShowInputBox="Always"
								SubmitButtonText="转到" NumericButtonTextFormatString="[{0}]" UrlPaging="True" CustomInfoSectionWidth="35%"
								PagingButtonSpacing="0" ImagePath="../images" ButtonImageNameExtension="n" CpiButtonImageNameExtension="r"
								DisabledButtonImageNameExtension="g" PageSize="10" AlwaysShow="True"></Webdiver:AspNetPager></TD>
					</TR>
				</TABLE>
			</asp:panel>
			<asp:literal id="litMessage" runat="server"></asp:literal>
			</form>
	</body>
</HTML>
